import java.util.concurrent.BlockingQueue;

public class BlockingQueueDequeuer implements Runnable {
	BlockingQueue<Integer> q;
	public BlockingQueueDequeuer(BlockingQueue<Integer> q) {
		this.q = q;
	}
	@Override
	public void run() {
		for(int i = 0; i < 50; i++) {
			System.out.println("polling");
			try {
				System.out.println("polled " + q.take());
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}
